<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>教务系统后台管理</title>
<link rel="stylesheet" href="../static/layui/css/layui.css"
	th:href="${'layui/css/layui.css'}">
<script type="text/javascript" src="layui/layui.js"></script>
<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
</head>
<body class="layui-layout-body">
	<div class="layui-layout layui-layout-admin">
		<div class="layui-header">
			<div class="layui-logo">教务平台</div>
			<!-- 头部区域（可配合layui已有的水平导航） -->
			<ul class="layui-nav layui-layout-left">
				<li class="layui-nav-item"><a href="student_information">学生个人主页</a></li>
				<li class="layui-nav-item"><a>学籍成绩</a>
					<dl class="layui-nav-child">
						<dd>
							<a id="student_grade">我的成绩</a>
						</dd>
						<dd>
							<a id="student_status">查询学籍</a>
						</dd>
						<dd>
							<a id="student_gradation">查询毕业信息</a>
						</dd>
					</dl></li>

				<li class="layui-nav-item"><a>培养管理</a>
					<dl class="layui-nav-child">
						<dd>
							<a id="mycourse">我的课表</a>
						</dd>
					</dl></li>

				<li class="layui-nav-item"><a>考试信息</a>
					<dl class="layui-nav-child">
						<dd>
							<a id="enlist_text">考试报名</a>
						</dd>
						<dd>
							<a id="mytest1">我的考试</a>
						</dd>
					</dl></li>

				<li class="layui-nav-item"><a href="evaluate">教学评价</a></li>
			</ul>
			<ul class="layui-nav layui-layout-right">
				<li class="layui-nav-item"><a href="javascript:;"> <img
						th:src="${image}" class="layui-nav-img"> [[${name}]]
				</a>
					<dl class="layui-nav-child">
						<dd>
							<a>基本资料</a>
						</dd>
						<dd>
							<a id="perfect_information">完善个人资料</a>
						</dd>
						<dd>
							<a th:href="change_password">更改密码</a>
						</dd>
					</dl></li>
				<li class="layui-nav-item"><a href="hello">退出</a></li>
			</ul>
		</div>

		<div class="layui-side layui-bg-black">
			<div class="layui-side-scroll">
				<!-- 左侧导航区域（可配合layui已有的垂直导航） -->
				<ul class="layui-nav layui-nav-tree">
					<li class="layui-nav-item"><a>学生个人信息</a>
						<dl class="layui-nav-child">
							<dd>
								<a id="perfect_information1">完善个人信息</a>
							</dd>
							<dd>
								<a id="change_information">修改个人信息</a>
							</dd>
						</dl></li>
					<li class="layui-nav-item"><a>学籍信息</a>
						<dl class="layui-nav-child">
							<dd>
								<a id="student_grade1">我的成绩</a>
							</dd>
							<dd>
								<a id="student_status1">查询学籍</a>
							</dd>
							<dd>
								<a id="student_gradation1">查询毕业信息</a>
							</dd>
						</dl></li>

					<li class="layui-nav-item"><a>培养方案</a>
						<dl class="layui-nav-child">
							<dd>
								<a id="mycourse1">我的课表</a>
							</dd>
						</dl></li>

					<li class="layui-nav-item"><a>考试信息</a>
						<dl class="layui-nav-child">
							<dd>
								<a id="enlist_text1">考试报名</a>
							</dd>
							<dd>
								<a id="mytest1">我的考试</a>
							</dd>
						</dl></li>

					<li class="layui-nav-item"><a href="evaluate">教学评价</a></li>
				</ul>
			</div>
		</div>

		<script>
			$("#perfect_information,#perfect_information1").click(function() {
				$.ajax({
					url : 'getstudent',
					dataType : 'json',
					type : 'post',
					success : function(data) {
						if (data == 0) {
							$("#pshow").toggle();
						} else {
							$("#p1").toggle();
						}

					}
				})
			});
			$("#change_information").click(function() {
				$.ajax({
					url : 'student',
					dataType : 'json',
					type : 'post',
					success : function(data) {
						if (data == 0) {
							$("#p2").toggle();
						} else {
							alert("请先完善个人信息");
						}

					}
				})
			});
			$("#student_grade,#student_grade1").click(function() {
				$.ajax({
					url : 'student',
					dataType : 'json',
					type : 'post',
					success : function(data) {
						if (data == 0) {
							$("#p3").toggle();
						} else {
							alert("请先完善个人信息");
						}
					}
				});
			});
			$("#student_status,#student_status1").click(function() {
				$.ajax({
					url : 'student',
					dataType : 'json',
					type : 'post',
					success : function(data) {
						if (data == 0) {
							$("#p4").toggle();
						} else {
							alert("请先完善个人信息");
						}
					}
				});

			});
			$("#student_gradation,#student_gradation1").click(function() {
				$.ajax({
					async : false,
					url : 'student',
					dataType : 'json',
					type : 'post',
					success : function(data) {
						if (data == 0) {
							$("#p5").toggle();
						} else {
							alert("请先完善个人信息");
						}
					}
				});
			});
			$("#mycourse,#mycourse1").click(function() {
				$.ajax({
					url : 'student',
					dataType : 'json',
					type : 'post',
					success : function(data) {
						if (data == 0) {
							$("#p6").toggle();
						} else {
							alert("请先完善个人信息");
						}
					}
				});
			});
			$("#enlist_text,#enlist_text1").click(function() {
				$.ajax({
					url : 'student',
					dataType : 'json',
					type : 'post',
					success : function(data) {
						if (data == 0) {
							$("#p7").toggle();
						} else {
							alert("请先完善个人信息");
						}
					}
				});

			});
			$("#mytest1,#mytest").click(function() {
				$.ajax({
					url : 'student',
					dataType : 'json',
					type : 'post',
					success : function(data) {
						if (data == 0) {
							$("#p8").toggle();
						} else {
							alert("请先完善个人信息");
						}
					}
				});

			});
		</script>
		<!-- 主体区域 -->
		<div class="layui-body"
			style="background: url(img/12.jpg); background-repeat: no-repeat; background-size: 100% 100%;">

			<!--完善个人信息  -->
			<div id="p1" hidden="hidden" style="padding: 15px; width: 1000px;">
				<div class="layui-tab" style="margin-left: 0px;">
					<blockquote class="layui-elem-quote">
						<h1>完善个人信息</h1>
					</blockquote>
				</div>
				<form class="layui-form" action="perfectstudent">
					<div class="layui-form-item">
						<label class="layui-form-label">身份证号</label>
						<div class="layui-input-block">
							<input type="text" name="ID_card" placeholder="请输入身份证号"
								class="layui-input">
							<div class="layui-form-mid layui-word-aux">绑定后不能修改信息</div>
						</div>

					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">手机号</label>
						<div class="layui-input-block">
							<input type="text" name="phone" placeholder="请输入手机号"
								class="layui-input">
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">邮箱</label>
						<div class="layui-input-block">
							<input type="text" name="box" placeholder="请输入邮箱"
								class="layui-input">
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">名字</label>
						<div class="layui-input-inline">
							<input type="text" name="student_name" placeholder="请输入名字"
								class="layui-input">
							<div class="layui-form-mid layui-word-aux">绑定后不能修改信息</div>
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">性别</label>
						<div class="layui-input-block">
							<input type="radio" name="sex" value="男" title="男"> <input
								type="radio" name="sex" value="女" title="女">
						</div>
						<div class="layui-form-mid layui-word-aux">绑定后不能修改信息</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">家庭住址</label>
						<div class="layui-input-block">
							<input type="text" name="home" placeholder="请输入家庭住址"
								class="layui-input">
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">所属院系</label>
						<div class="layui-input-block">
							<select name="college" id="college">
								<option value=""></option>
							</select>
						</div>
					</div>



					<div class="layui-form-item">
						<div class="layui-input-block">
							<button type="button" class="layui-btn" id="test1">
								<i class="layui-icon">&#xe67c;</i>上传头像
							</button>
							<button class="layui-btn">立即提交</button>
							<button type="reset" class="layui-btn layui-btn-primary">重置</button>
						</div>
					</div>
				</form>
			</div>

			<!-- 提示个人信息已经完善 -->
			<div id="pshow" hidden="hidden" style="padding: 15px; width: 1000px;">
				<div class="layui-tab" style="margin-left: 0px;">
					<blockquote class="layui-elem-quote">
						<h1>个人信息已经完善</h1>
					</blockquote>
				</div>
			</div>

			<!--修改个人信息  -->
			<div id="p2" hidden="hidden" style="padding: 15px; width: 1000px;">
				<div class="layui-tab" style="margin-left: 0px;">
					<blockquote class="layui-elem-quote">
						<h1>完善个人信息</h1>
					</blockquote>
				</div>
				<form class="layui-form" action="changeinformation">
					<div class="layui-form-item">
						<label class="layui-form-label">手机号</label>
						<div class="layui-input-block">
							<input type="text" name="changephone" placeholder="请输入手机号"
								class="layui-input">
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">邮箱</label>
						<div class="layui-input-block">
							<input type="text" name="changebox" placeholder="请输入邮箱"
								class="layui-input">
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">家庭住址</label>
						<div class="layui-input-block">
							<input type="text" name="changehome" placeholder="请输入家庭住址"
								class="layui-input">
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">所属院系</label>
						<div class="layui-input-block">
							<select name="changecollege" id="changecollege">
								<option value=""></option>
							</select>
						</div>
					</div>

					<div class="layui-form-item">
						<div class="layui-input-block">
							<button class="layui-btn">立即提交</button>
							<button type="reset" class="layui-btn layui-btn-primary">重置</button>
						</div>
					</div>
				</form>
			</div>

			<!--学生成绩单  -->
			<div id="p3" hidden="hidden" style="padding: 15px; width: 1000px;">
				<div class="layui-tab" style="margin-left: 0px;">
					<blockquote class="layui-elem-quote">
						<h1>成绩单</h1>
					</blockquote>
				</div>
				<table id="achievement" lay-filter="test"></table>
			</div>

			<!-- 学籍信息查询 -->
			<div id="p4" hidden="hidden" style="padding: 15px; width: 1000px;">
				<fieldset class="layui-elem-field">
					<legend>学籍信息</legend>
					<div class="layui-col-md9">
						<div class="layui-field-box">
							<h3>入学年份：[[${msg}]]</h3>
							<br> <br>
							<h3>结业年份：[[${msg1}]]</h3>
							<br> <br>
							<h3>年级：[[${msg2}]]</h3>
						</div>
					</div>
					<div class="layui-col-md3">
						<img src="/showImage" height="200" width="200">
					</div>
				</fieldset>
			</div>

			<!-- 查询毕业信息 -->
			<div id="p5" hidden="hidden" style="padding: 15px; width: 1000px;">
				<fieldset class="layui-elem-field">
					<legend>毕业信息</legend>
					<div class="layui-field-box">
						<h3 id="n1">[[${grade}]]</h3>
						<br>
					</div>
				</fieldset>
			</div>

			<!--学生课程表  -->
			<div id="p6" hidden="hidden" style="padding: 15px; width: 1000px;">
				<div class="layui-tab" style="margin-left: 0px;">
					<blockquote class="layui-elem-quote">
						<h1>课程表</h1>
					</blockquote>
				</div>

				<div class="demoTable">
					搜索：
					<div class="layui-inline">
						<input class="layui-input" name="Coursename" id="Coursename"
							autocomplete="off" placeholder="课程名">
					</div>
					<div class="layui-inline">
						<input class="layui-input" name="teacher" id="teacher"
							autocomplete="off" placeholder="教师">
					</div>
					<button class="layui-btn" id="search">搜索</button>
				</div>
				<table id="course" lay-filter="test"></table>
			</div>

			<!-- 考试报名 -->
			<div id="p7" hidden="hidden" style="padding: 15px; width: 1000px;">
				<fieldset class="layui-elem-field">
					<legend>考试报名</legend>
					<div class="layui-field-box">
						<h3>
							<a href="http://cet.neea.edu.cn/">四级报名网址</a>
						</h3>
						<br>
						<h3>
							<a href="http://cet.neea.edu.cn/">六级报名网址</a>
						</h3>
						<br>
						<h3>
							<a href="http://42.101.89.194:9010/tyzpwb/">黑龙江省公务员报名网址</a>
						</h3>
						<br>
						<h3>
							<a href="https://ielts.neea.cn/">黑龙江省公务员报名网址</a>
						</h3>
						<br>
						<br>
						<h3>校内考试</h3>
						<br>
						<table id="testinformation" lay-filter="test"></table>
					</div>
				</fieldset>
			</div>

			<!-- 我的考试 -->
			<div id="p8" hidden="hidden" style="padding: 15px; width: 1000px;">
				<fieldset class="layui-elem-field">
					<legend>我的考试成绩</legend>
					<table id="test" lay-filter="test"></table>
				</fieldset>
			</div>

		</div>

		<!-- 下拉框 -->
		<script type="text/javascript">
			layui.use([ 'form', 'upload', 'layer' ], function() {
				var form = layui.form;
				$.ajax({
					url : 'getcollege',
					dataType : 'json',
					type : 'post',
					success : function(data) {
						//console.log(data);//下面会提到这个data是什么值
						//使用循环遍历，给下拉列表赋值
						$.each(data, function(index, value) {
							console.log(value.college_name);
							$('#college')
									.append(new Option(value.college_name)); // 下拉菜单里添加元素
							$('#changecollege').append(
									new Option(value.college_name));
						});
						form.render("select"); //重新渲染 固定写法
					}
				})
			});
		</script>

		<!--成绩表格 -->
		<script type="text/javascript" th:inline="none">
			$("#student_grade,#student_grade1").click(function() {
				layui.use('table', function() {
					var table = layui.table;
					table.render({
						elem : '#achievement',
						url : 'queryachievement',
						cols : [ [ {
							field : 'course_name',
							width : 500,
							title : '课程名'
						}, {
							field : 'score',
							width : 500,
							title : '成绩',
							sort : true
						} ] ],
						page : true,
						width : 1000,
						parseData : function(data) {
							return {
								"code" : 0,
								"msg" : "",
								"count" : data.length,
								"data" : data
							}
						}
					});
				});
			});
		</script>

		<!-- 上传图片 -->
		<script>
			layui.use('upload', function() {
				var upload = layui.upload;
				//执行实例
				var uploadInst = upload.render({
					elem : '#test1', //绑定元素
					url : 'upload', //上传接口
					done : function(res) {
					}
				});
			});
		</script>

		<!-- 课程表格 -->
		<script type="text/javascript" th:inline="none">
			$("#mycourse,#mycourse1").click(function() {
				layui.use('table', function() {
					var table = layui.table;
					table.render({
						elem : '#course',
						url : 'getCourse',
						cols : [ [ {
							field : 'course_name',
							width : 400,
							title : '课程名'
						}, {
							field : 'course_time',
							width : 400,
							title : '课程时间'
						}, {
							field : 'teacher_name',
							width : 200,
							title : '教师姓名'
						} ] ],
						page : true,
						width : 1000,
						parseData : function(data) {
							return {
								"code" : 0,
								"msg" : "",
								"count" : data.length,
								"data" : data
							}
						}
					});
				});
			});
		</script>

		<!-- 动态查询课程表格 -->
		<script>
			$("#search").click(function() {
				var name = document.getElementById("Coursename").value;
				var teacher = document.getElementById("teacher").value;
				$.ajax({
					url : 'getCourseByName',
					dataType : 'json',
					type : 'post',
					data : {
						"name" : name,
						"teacher" : teacher
					},
				});

				layui.use('table', function() {
					var table = layui.table;
					table.render({
						elem : '#course',
						url : 'getCoursebyName',
						cols : [ [ {
							field : 'course_name',
							width : 400,
							title : '课程名'
						}, {
							field : 'course_time',
							width : 400,
							title : '课程时间'
						}, {
							field : 'teacher_name',
							width : 200,
							title : '教师姓名'
						} ] ],
						page : true,
						width : 1000,
						parseData : function(data) {
							return {
								"code" : 0,
								"msg" : "",
								"count" : data.length,
								"data" : data
							}
						}
					});
				});
			});
		</script>

		<!-- 学生成绩表格 -->
		<script>
			$.ajax({
				url : 'student',
				dataType : 'json',
				type : 'post',
				success : function(data) {
					if (data == 0) {
						$("#mytest1,#mytest").click(function() {
							layui.use('table', function() {
								var table = layui.table;
								table.render({
									elem : '#test',
									url : 'getTest',
									cols : [ [ {
										field : 'course_name',
										width : 500,
										title : '课程名'
									}, {
										field : 'score',
										width : 500,
										title : '分数',
										sort : true
									} ] ],
									page : true,
									width : 1000,
									parseData : function(data) {
										return {
											"code" : 0,
											"msg" : "",
											"count" : data.length,
											"data" : data
										}
									}
								});
							});
						});
					} else {
					}
				}
			});
		</script>

		<!-- 学生考试信息 -->
		<script>
			$.ajax({
				url : 'student',
				dataType : 'json',
				type : 'post',
				success : function(data) {
					if (data == 0) {
						$("#enlist_text,#enlist_text1").click(function() {
							layui.use('table', function() {
								var table = layui.table;
								table.render({
									elem : '#testinformation',
									url : 'getTestInformation',
									cols : [ [ {
										field : 'id',
										width : 200,
										title : '序列号'
									}, {
										field : 'course_name',
										width : 200,
										title : '课程名'
									} , {
										field : 'exam_name',
										width : 200,
										title : '考试名称'
									},  {
										field : 'exam_time',
										width : 200,
										title : '考试时间',
										sort : true
									}, {
										field : 'exam_msg',
										width : 200,
										title : '考试地点'
									}] ],
									page : true,
									width : 1000,
									parseData : function(data) {
										return {
											"code" : 0,
											"msg" : "",
											"count" : data.length,
											"data" : data
										}
									}
								});
							});
						});
					} else {
					}
				}
			});
		</script>
		
		<div class="layui-footer">底部固定区域</div>
	</div>
</body>
</html>